package com.xinsoft.entity.dto;

import cn.hutool.core.util.ObjectUtil;
import com.xinsoft.entity.vo.ErpSourcingFeedingItemVO;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author: π
 * 生产投料单 明细
 * */
@Data
public class KisSourcingFeedingBodyDto {


    private String FInterId;         //主表主键
    private String  FEntryID;       //行号" 金蝶子表主键
    private String  FAuxQty;       //选单数量"
    private String  FQty;       //基本单位选单数量"
    private String  FQtyMust;       //"
    private String  FItemID;       //物料代码"
    private String  FBomInterID;       //客户BOM编号"
    private String  FUnitID;       //单位"
    private String  FStockQty;       //基本单位已领数量"
    private String  FAuxStockQty;       //已领数量"
    private String  FNote;       //备注"
    private String  FPlanMode;       //计划模式"
    private String  FMTONo;       //计划跟踪号"
    private Integer  FICMOInterID;       //委外订单id
    private Integer  FOrderEntryID;       //委外订单行号

    public ErpSourcingFeedingItemVO voToPo(KisSourcingFeedingBodyDto item) {
        if (item == null) {
            return null;
        }
        ErpSourcingFeedingItemVO mesProductionFeedingItemVO = new ErpSourcingFeedingItemVO();
        mesProductionFeedingItemVO.setHeadId(ObjectUtil.isEmpty(item.getFInterId()) ? null : new Integer(item.getFInterId()));
        mesProductionFeedingItemVO.setId(ObjectUtil.isEmpty(item.getFEntryID()) ? null : new Integer(item.getFEntryID()));
        mesProductionFeedingItemVO.setNum(ObjectUtil.isEmpty(item.getFQtyMust()) ? null : new BigDecimal(item.getFQtyMust()).stripTrailingZeros());
        mesProductionFeedingItemVO.setAuxNum(ObjectUtil.isEmpty(item.getFQtyMust()) ? null : new BigDecimal(item.getFQtyMust()).stripTrailingZeros());
        mesProductionFeedingItemVO.setMaterialId(ObjectUtil.isEmpty(item.getFItemID()) ? null : new Integer(item.getFItemID()));
        mesProductionFeedingItemVO.setBomId(ObjectUtil.isEmpty(item.getFBomInterID()) ? null : new Integer(item.getFBomInterID()));
        mesProductionFeedingItemVO.setMainUnitId(ObjectUtil.isEmpty(item.getFUnitID()) ? null : new Integer(item.getFUnitID()));
        mesProductionFeedingItemVO.setReceiveNum(ObjectUtil.isEmpty(item.getFStockQty()) ? null : new BigDecimal(item.getFStockQty()).stripTrailingZeros());
        mesProductionFeedingItemVO.setAuxReceiveNum(ObjectUtil.isEmpty(item.getFAuxStockQty()) ? null : new BigDecimal(item.getFAuxStockQty()).stripTrailingZeros());
        mesProductionFeedingItemVO.setRemark(item.getFNote());
        mesProductionFeedingItemVO.setSourceId(item.getFICMOInterID());
        mesProductionFeedingItemVO.setSourceItemId(item.getFOrderEntryID());
        return mesProductionFeedingItemVO;
    }
//    {
//          \"FInterID\": \"14608\",        //主表主键
//          \"FEntryID\": \"1\",            //行号" 金蝶子表主键
//          \"FItemID\": \"5757\",          //物料代码"
//          \"FBOMInterID\": \"2195\",      //BOM编号"
//          \"FUnitID\": \"1413\",          //单位"
//          \"FAuxQty\": \"1000.0\",        //选单数量"
//          \"FQty\": \"1000.0000000000\",  //基本单位选单数量"
//          \"FStockQty\": \"0.0000000000\",//基本单位已领数量"
//          \"FAuxStockQty\": \"0.0000000000\",//已领数量"
//          \"FPlanMode\": \"14036\",       //计划模式"
//          \"FNote\": \"\",                   //备注"
//          \"FMTONo\": \"\",               //计划跟踪号"
//          \"FIndex\": \"0\",
//          \"FDetailID\": \"58\",
//          \"FMapID\": \"0\",
//          \"FMapName\": \"\",
//          \"FAuxPropID\": \"0\",
//          \"FSecQty\": \"0.0000000000\",
//          \"FSecCommitQty\": \"0.0000000000\",
//          \"FSecCoefficient\": \"0.0000000000\",
//          \"FAuxPrice\": \"1.0297030000\",
//          \"FAuxTaxPrice\": \"1.0400000300\",
//          \"FAmount\": \"1029.7000\",
//          \"FDiscountRate\": \"0.0000000000\",
//          \"FAuxPriceDiscount\": \"1.0400000300\",
//          \"FAmtDiscount\": \"0.0000\",
//          \"FTaxRate\": \"1.0000000000\",
//          \"FTaxAmount\": \"10.3000000000\",
//          \"FAllAmount\": \"1040.0000000000\",
//          \"FStdAllAmount\": \"1040.0000000000\",
//          \"FPayShipDate\": \"8/10/2023 12:00:00 AM\",
//          \"FFetchDate\": \"8/10/2023 12:00:00 AM\",
//          \"FInHighLimit\": \"0.0000000000\",
//          \"FInLowLimit\": \"0.0000000000\",
//          \"FMrpAutoClosed\": \"1\",
//          \"FMrpClosed\": \"0\",
//          \"FMRPLockFlag\": \"0\",
//          \"FClassTypeID_SRC\": \"0\",
//          \"FEntryID_SRC\": \"0\",
//          \"FInterID_SRC\": \"0\",
//          \"FBillNo_SRC\": \"\",
//          \"FInterIDOrder_SRC\": \"0\",
//          \"FEntryIDOrder_SRC\": \"0\",
//          \"FOrderNo\": \"\",
//          \"FInHighLimitQty\": \"1000.0000000000\",
//          \"FInLowLimitQty\": \"1000.0000000000\",
//          \"FAuxCommitQty\": \"0.0000000000\",
//          \"FCommitQty\": \"0.0000000000\",
//          \"FAuxQtyInvoice\": \"0.0000000000\",
//          \"FQtyInvoice\": \"0.0000000000\",
//          \"FReceiveAmountFor_Commit\": \"0.0000\",
//          \"FMrpTrackFlag\": \"0\",
//          \"FPORInterID\": \"0\",
//          \"FPORNumber\": \"\",
//          \"FBCommitQty\": \"0.0000000000\",
//          \"FAuxBCommitQty\": \"0.0000000000\",
//          \"FSecQtyInvoice\": \"0.0000000000\",
//          \"FSecBCommitQty\": \"0.0000000000\",
//          \"FSecStockQty\": \"0.0000000000\",
//          \"FText\": \"\"
//    }

}
